home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / PDraw3.0.adf / pdraw_rex.lzh / ImportText.pdrx < prev    next >
Text File  |  1992-06-15  |  820b  |  43 lines

  1. /*
  2. @N
  3.  
  4. This Genie will import a text file into a rectangular region
  5. */
  6.  
  7. cr = '0a'x
  8.  
  9. filename = pdm_GetFileName("Select text file..", "", "")
  10. if filename = "" then exit_msg()
  11.  
  12. if ~open(file, filename, r) then exit_msg("Unable to open "filename)
  13.  
  14. rect = pdm_ClickArea("Drag out area to flow text..")
  15. parse var rect left ' ' top ' ' right ' ' bottom
  16.  
  17. call pdm_ShowStatus("Reading font list...")
  18. fonts = pdm_InitText()
  19.  
  20. line = ''
  21.  
  22. call pdm_ShowStatus("Importing text...")
  23.  
  24. do while ~eof(file)
  25.     line = line || '0a'x || readln(file)
  26. end
  27.  
  28. call close(file)
  29.  
  30. call pdm_ShowStatus("Rendering text...")
  31.  
  32. if line ~= '' then call pdm_FlowText(substr(line,2), left, top, right, bottom)
  33.  
  34. exit_msg("Done")
  35.  
  36. exit_msg: procedure
  37. do
  38.     parse arg message
  39.     if message ~= '' then call pdm_Inform(1,message,)
  40.     call pdm_ClearStatus()
  41.     exit
  42. end
  43.